package cn.edu.scau.cmi.liyunlin.Singleton;

import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.control.TextField;

import javafx.scene.control.TextArea;

public class SingletonController {
	@FXML
	private TextField input1;
	@FXML
	private TextField input2;
	@FXML
	private Button btn1;
	@FXML
	private Button btn2;
	@FXML
	private TextArea msg1;
	@FXML
	private TextArea msg2;
	
	public void btn1Event() {
		// String chairman = input1.getText();
		Chairman chairman = Chairman.getInstance(input1.getText());
		String message = chairman.getName() + chairman.toString();
		msg1.setText(msg1.getText() + message + "已创建！\n");
		System.out.println(message + "已创建！\n");
	}
	
	public void btn2Event() {
		String judgeName = Marshal.judgeName(input2.getText());
		if(judgeName == "1") {
			Marshal marshal = Marshal.getInstance(input2.getText());
			msg2.setText(msg2.getText() + input2.getText() + marshal.toString() + "已创建！\n");
		} else {
			msg2.setText(msg2.getText() + judgeName);
		}
	}

}
